home *** CD-ROM | disk | FTP | other *** search
- Path: news.internet-eireann.ie!usenet
- From: mkelly@vocean.ie
- Newsgroups: comp.lang.c++
- Subject: Simple DLL Problem
- Date: Tue, 09 Jan 1996 14:02:30 GMT
- Organization: vocean
- Message-ID: <30f27530.80885051@news.internet-eireann.ie>
- NNTP-Posting-Host: vocean.internet-eireann.ie
- X-Newsreader: Forte Agent .99c/16.141
-
- Problem Writing a Simple DLL!
-
- Hi,
-
- Can anyone tell me where I am going wrong with the following Visual
- C++ code?
-
- Below is the code for my first DLL written in VC++ 1.5. The code
- compiles and a DLL is built, but when it is called from the calling
- Visual Basic program, I get the error
- æ Sub or Function not defined æ
-
- It would appear that the DLL file is being located, but that the
- function is not being recognised.
- The DLL code is called from a working VB program and is properly
- declared therein as an API function.
- I have listed the Compiler and Linker options after the code if that
- is of Help.
- Thanks
-
- Martin
-
- ----------------------------------------mySum.h-----------------------------
- #include <afxwin.h>
-
- #ifdef _cplusplus
- extern "C" {
- #endif
-
- int FAR PASCAL _export mySum(int a, int b);
-
- #ifdef _cplusplus
- }
- #endif
-
-
- ------------------------------- mySum.cpp
- ---------------------------------
- #include "mysum.h"
-
- int FAR PASCAL _export mySum(int a,int b)
- {
- int res;
-
- res = a + b;
- return res;
- }
-
-
- ------------------------------ mySum.def
- ---------------------------------
- LIBRARY MYSUM
- EXETYPE WINDOWS
- CODE PRELOAD MOVEABLE DISCARDABLE
- DATA PRELOAD MOVEABLE SINGLE
- HEAPSIZE 1024
- EXPORTS
- WEP @1 RESIDENTNAME
- ----------------------------------------------------------------------------
-
- Compiler Options:
- /nologo /G2 /W3 /Zi /ALw /Od /D "_DEBUG" /D "_USRDLL" /D "_WINDLL" /D
- "_cplusplus" /FR /GD /Fd"MYSUM.PDB"
-
- Linker Options:
- /NOLOGO /LIB:"lafxdwd" /LIB:"oldnames" /LIB:"libw" /LIB:"ldllcew" /NOD
- /NOE /PACKC:61440 /ALIGN:16 /ONERROR:NOEXE /CO /LIB:"commdlg.lib"
- /LIB:"olecli.lib" /LIB:"olesvr.lib" /LIB:"shell.lib" /MAP:FULL
-
-
-